import { request } from './index'

// 地址列表
export function GetAddress () {
  return request({
    url: '/api/address',
    method: 'get'
  })
}

// 添加地址
export function AddAddress (data: any) {
  return request({
    url: '/api/address',
    method: 'post',
    data: data
  })
}

// 地址详情
export function GetAddressDetail (id: number) {
  return request({
    url: `/api/address/${id}`,
    method: 'get'
  })
}

// 修改地址
export function UpdateAddress (id: number, data: any) {
  return request({
    url: `/api/address/${id}`,
    method: 'put',
    data: data
  })
}

// 删除地址
export function DeleteAddress (id: number) {
  return request({
    url: `/api/address/${id}`,
    method: 'delete'
  })
}


// 设置默认地址
export function DefaultAddress (id: number) {
  return request({
    url: `/api/address/${id}/default`,
    method: 'PATCH'
  })
}
